import request from "@/utils/request";

const LOG_BASE_URL = "/v3/manager/device";

class DeviceManagementApi {
  /**
   * 批量转出设备
   *
   */
  static batchTurnOut(queryParams: TurnOut) {
    return request({
      url: `${LOG_BASE_URL}/batchTurnOut`,
      method: "post",
      headers: {
        "Content-Type": "application/json",
      },
      data: queryParams,
    });
  }
  /**
   * 获取分页列表
   *
   */
  static getManagementPage(queryParams: ManagementPage) {
    return request<any, getpagetype>({
      url: `${LOG_BASE_URL}/complexPage`,
      method: "post",
      headers: {
        "Content-Type": "application/json",
      },
      data: queryParams,
    });
  }
  /**
   * 获取过期分页列表
   *
   */
  static getExpirePage(queryParams: ExpirePage) {
    return request<any, ExpireList>({
      url: `${LOG_BASE_URL}/expirePage`,
      method: "post",
      headers: {
        "Content-Type": "application/json",
      },
      data: queryParams,
    });
  }
}

export default DeviceManagementApi;

// 批量转出设备
interface TurnOut {
  customerName: string;
  deviceIdList: string[];
}
/**
 * 分页查询对象
 */
export interface ManagementPage {
  /** 搜索关键字 */
  pages?: any;
  key?: string;
  deviceStatus?: string;
  onlineStatus?: string;
  expireStatus?: string;
  deviceTypeId: string;
  customerId: string;
  isChild?: boolean;
}

export interface getpagetype {
  countInfo: any;
  data: any;
  headers: any[];
}
/**
 * 过期分页查询对象
 */
export interface ExpirePage {
  /** 搜索关键字 */
  pages?: any;
  expireStatus?: string;
  onlineStatus?: string;
  expireTime?: number | string;
  unit?: string;
}
export interface ExpireList {
  /** 搜索关键字 */
  records?: any;
  pages?: string;
  current?: string;
  size?: number;
  total?: string;
}

/**
 * 分页查询对象
 */
export interface ManagementPageList {
  headers: any;
  data: any;
}
